package com.zr.planclass.meiju;

/**
 * Created by 86151 on 2019/4/25.
 */
public enum TypeEnum {
    CAIGOU(0,"采购询价"),BAOFEI(1,"报废询价");

    private final String typeName;
    private final Integer typeValue;

    private TypeEnum(Integer typeValue, String typeName)
    {
        this.typeName = typeName;
        this.typeValue = typeValue;
    }

    // 通过值取名称
    public static String getName(int typeValue) {
        for (TypeEnum t : TypeEnum.values()) {
            if (t.getEnumValue() == typeValue) {
                return t.typeName;
            }
        }

        return null;
    }
    // 通过名称取值
    public static Integer getValue(String typeName) {
        for (TypeEnum t : TypeEnum.values()) {
            if (t.getEnumName().equals(typeName)) {
                return t.getEnumValue();
            }
        }
        return null;
    }

    public String getEnumName() {
        return typeName;
    }

    public Integer getEnumValue() {
        return typeValue;
    }
}
